package com.yupi.springbootinit.spark;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;

public class SparkChat {

    private  String question;
    private  Object apiKey;
    private  Object apiSecret;
    private  Object appid;
    private  Object host;
    private  Object path;
    private  Object domain;
    private  long userId;

    public SparkChat(SparkConfig sparkConfig, long userId, String question) {
        this.userId = userId;
        this.question = question;
        this.apiKey = sparkConfig.getApiKey();
        this.apiSecret = sparkConfig.getApiSecret();
        this.appid = sparkConfig.getAppId();
        if (sparkConfig.getModelVersion() != null) {
//            this.host = sparkConfig.getHostInfos().get(Integer.parseInt(sparkConfig.getModelVersion()) - 1).getHost();
//            this.path = sparkConfig.getHostInfos().get(Integer.parseInt(sparkConfig.getModelVersion()) - 1).getPath();
//            this.domain = sparkConfig.getHostInfos().get(Integer.parseInt(sparkConfig.getModelVersion()) - 1).getDomain();
        } else {
            this.host = sparkConfig.getDefaultHostInfo().getHost();
            this.path = sparkConfig.getDefaultHostInfo().getPath();
            this.domain = sparkConfig.getDefaultHostInfo().getDomain();
        }
    }
}
